import datetime as dt
import uuid
from typing import Any

import pytest

from recruit.adapter.database.models import (
    Base,
    ResumePosition,
    ResumeInfo,
    ResumeSalary,
    ResumeContact,
    ResumeWork,
    ResumeSkill,
    ResumeAboutUs,
    ResumeEducation,
)
from tests.adapter.models.utils import get_model_resume


@pytest.fixture
def get_resume_position() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'resume_id': uuid.uuid4(),
        'position': 'Position',
        'employment': 'Employment',
        'work_schedule': 'WorkSchedule'
    }


@pytest.fixture
def get_resume_about_us() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'resume_id': uuid.uuid4(),
        'about_us': 'AboutUs'
    }


@pytest.fixture
def get_resume_contact() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'resume_id': uuid.uuid4(),
        'email': 'Email',
        'phone': 'phone',
        'telegram': '@username'
    }


@pytest.fixture
def get_resume_education() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'resume_id': uuid.uuid4(),
        'year': dt.date.today().year,
        'education_institution': 'Education Institution',
        'faculty': 'Faculty',
        'specialization': 'Specialization',
        'graduation_year': dt.date.today().year
    }


@pytest.fixture
def get_resume_info() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'resume_id': uuid.uuid4(),
        'name': 'Name',
        'patronymic': 'Patronymic',
        'surname': 'Surname',
        'residence': 'Residence'
    }


@pytest.fixture
def get_resume_salary() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'resume_id': uuid.uuid4(),
        'salary': '500000 рублей'
    }


@pytest.fixture
def get_resume_skill() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'resume_id': uuid.uuid4(),
        'skill': 'Skill'
    }


@pytest.fixture
def get_resume_work() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'resume_id': uuid.uuid4(),
        'start_work': dt.date.today().year,
        'end_work': dt.date.today().year,
        'position': 'Position',
        'company': 'Company',
        'workplace': 'Workplace'
    }


@pytest.fixture
def get_resume() -> dict[str, Any]:
    return {
        'id': uuid.uuid4(),
        'user_id': uuid.uuid4()
    }


@pytest.fixture
def get_resume_models(
        get_resume_info,
        get_resume_position: dict[str, Any],
        get_resume_salary,
        get_resume_contact,
        get_resume_work,
        get_resume_skill,
        get_resume_about_us,
        get_resume_education
) -> dict[str, tuple[Base, type[Base]]]:
    return {
        'resume_info': (get_model_resume(
            ResumeInfo,
            get_resume_info
        ), ResumeInfo),
        'resume_position': (get_model_resume(
            ResumePosition,
            get_resume_position
        ), ResumePosition),
        'resume_salary': (get_model_resume(
            ResumeSalary,
            get_resume_salary
        ), ResumeSalary),
        'resume_contact': (get_model_resume(
            ResumeContact,
            get_resume_contact
        ), ResumeContact),
        'resume_work': (get_model_resume(
            ResumeWork,
            get_resume_work
        ), ResumeWork),
        'resume_skill': (get_model_resume(
            ResumeSkill,
            get_resume_skill
        ), ResumeSkill),
        'resume_about_us': (get_model_resume(
            ResumeAboutUs,
            get_resume_about_us
        ), ResumeAboutUs),
        'resume_education': (get_model_resume(
            ResumeEducation,
            get_resume_education
        ), ResumeEducation)
    }
